<template>
    <div class="settings">
      <h1>设置</h1>
      <p>在这里可以进行应用的个性化设置。</p>
  
      <!-- 主题设置 -->
      <div class="setting-item">
        <label for="theme">主题：</label>
        <el-select v-model="theme" placeholder="选择主题" class="setting-select">
          <el-option label="亮色模式" value="light"></el-option>
          <el-option label="暗色模式" value="dark"></el-option>
        </el-select>
      </div>
  
      <!-- 通知设置 -->
      <div class="setting-item">
        <label>通知：</label>
        <el-switch v-model="notifications" active-text="开启" inactive-text="关闭"></el-switch>
      </div>
  
      <!-- 语言选择 -->
      <div class="setting-item">
        <label for="language">语言：</label>
        <el-select v-model="language" placeholder="选择语言" class="setting-select">
          <el-option label="简体中文" value="zh"></el-option>
          <el-option label="English" value="en"></el-option>
          <el-option label="日本語" value="jp"></el-option>
          <el-option label="Français" value="fr"></el-option>
        </el-select>
      </div>
  
      <!-- 声音设置 -->
      <div class="setting-item">
        <label for="volume">音量：</label>
        <el-slider v-model="volume" :min="0" :max="100" show-tooltip></el-slider>
      </div>
  
      <!-- 字体大小设置 -->
      <div class="setting-item">
        <label for="font-size">字体大小：</label>
        <el-slider v-model="fontSize" :min="12" :max="24" show-tooltip></el-slider>
      </div>
  
      <!-- 隐私设置 -->
      <div class="setting-item">
        <label>启用位置服务：</label>
        <el-switch v-model="locationService" active-text="已开启" inactive-text="已关闭"></el-switch>
      </div>
  
      <div class="setting-item">
        <label>允许收集使用数据：</label>
        <el-switch v-model="dataCollection" active-text="已开启" inactive-text="已关闭"></el-switch>
      </div>
  
      <!-- 保存设置按钮 -->
      <div class="setting-item">
        <el-button type="primary" @click="saveSettings">保存设置</el-button>
      </div>
    </div>
  </template>
  
  <script setup>
  import { ref } from 'vue';
  import { ElMessage } from 'element-plus';
  
  // 初始化设置项的状态
  const theme = ref('light'); // 主题设置
  const notifications = ref(true); // 通知开关
  const language = ref('zh'); // 语言选择
  const volume = ref(50); // 声音设置
  const fontSize = ref(16); // 字体大小设置
  const locationService = ref(false); // 是否启用位置服务
  const dataCollection = ref(false); // 是否允许收集使用数据
  
  // 保存设置的函数
  const saveSettings = () => {
    // 模拟保存设置的逻辑
    ElMessage({
      message: '设置已保存！',
      type: 'success',
    });
  };
  </script>
  
  <style scoped>
  .settings {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    min-height: 100vh;
    max-width: 800px;
    margin: 0 auto;
  }
  
  h1 {
    font-size: 28px;
    margin-bottom: 20px;
  }
  
  .setting-item {
    margin-bottom: 20px;
    width: 100%;
    max-width: 600px;
    display: grid;
    grid-template-columns: 150px 1fr;
    align-items: center;
  }
  
  label {
    font-size: 16px;
  }
  
  .setting-select {
    width: 100%;
    max-width: 200px;
  }
  
  .el-slider {
    width: 100%;
    max-width: 300px;
  }
  </style>
  